package com.flong.jsoup.fl;

import java.net.URL;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class ZfwTest {

	
	public static void main(String[] args)throws Exception {
		
		//合同纠纷  http://china.findlaw.cn/ask/p104001_d201706_t00_page22/
		//公司法务  http://china.findlaw.cn/ask/p9_d201706_t00_page13/
		//房产土地  http://china.findlaw.cn/ask/p30_t00_page115/
		//债权债务  http://china.findlaw.cn/ask/p16_t00_page82//
		//婚姻家庭  http://china.findlaw.cn/ask/p17_t00_page202/
		
		
		StringBuilder buffer =new StringBuilder();
	 	for (int i = 1; i <=1; i++) { 
	 		String url  = "http://china.findlaw.cn/ask/p17_t00_page"+i;
			Document doc = Jsoup.parse(new URL(url), 30000);
			if(doc!=null){
				Elements lis = doc.select("div[class='box_question']").select("li:gt(0)");
				for(Element li: lis){
					 String href = li.select("div[class='b_title']").select("span:eq(1)").select("a").attr("href");
					 String diqu = li.select("div[class='b_title']").select("span:eq(1)").select("em").text();
					 buffer.append(href+"\n");
				}
			}
	 	}
		
	 	String string = buffer.toString();
	 	
	 	System.out.println(string);
		
	}
	
}
